#单词逆序
def reverserWords(s: str):
    #以空格进行分割放到列表中
    token = s.split()
    #对列表进行逆序
    token.reverse()
    #以空格作为分割返回
    return ' '.join(token)

# print(reverserWords("I am a student"))

#旋转字符串
def rotateString(s,goal):
    if len(s) != len(goal):
        return False
    return goal in s+s

# print(rotateString("abcdef","bcdefa"))
# print(rotateString("abcdef","bdea"))
# print(rotateString("abcdef","jcdefa"))

#统计字符串前缀
def countPrefixes(words: list, s: str):
    count = 0
    for word in words:
        if s.startswith(word):
            count += 1
    return count

print(countPrefixes(['a', 'b', 'c', 'ab', 'bc', 'abc'], 'abc'))
print(countPrefixes(['a', 'a'], 'aa'))



